<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<title>查看日志列表</title>
		<!-- css代码 start -->
		<link href="../../../css/mui.min.css" rel="stylesheet" />
		<link href="../../../css/global.css" rel="stylesheet" />
		<link href="../../../css/style.css" rel="stylesheet" />
		<link href="../../../css/checkbox.css" rel="stylesheet" />
		<link href="../../../css/task.css" rel="stylesheet" />
		<style type="text/css">
			.item_box .item .text span{
				width: auto;
			}
			.item_box .item .type .lpl {
				width: 135px;
			}
			.txt-overflow{
				flex: 1;
				text-overflow: ellipsis;
				overflow: hidden;
				white-space: nowrap;
			}
		</style>
		<!-- css代码 end -->
	</head>
	<body>
		<!-- html代码 start -->
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 id="title" class="mui-title">查看日志列表</h1>
		</header>
		<div class="mui-content">
			<div class="page_cen shadow title_num" id="dianji">服务通知编号：<span id="serviceNo" style="color: #ea1e1a;"></span></div>
			<div class="item_box" id="itemBox">
				<!-- <div class="item">
					<div class="text">
						<spa><img src="../../../images/icon_77.png" />到达现场时间：2020-03-15 08:45</span> 
					</div>
					<div class="type">
						<p>工作内容<img src="../../../images/icon_76.png"/></p>
						<p class="t_info">检测混在产品中的金属异物以及密度较大的非金属异物等</p>
					</div>
				</div> -->
			</div>
		</div>
		<!-- html代码 end -->

		<!-- js代码 start -->

		<!-- 基础js start -->
		<script src="../../../js/mui.min.js"></script>
		<script src="../../../js/utils/h.js"></script>
		<script src="../../../js/constant.js"></script>
		<script src="../../../js/common.js"></script>
		<script src="../../../js/utils/base64.js"></script>
		<script src="../../../js/utils/md5.js"></script>
		<script src="../../../js/utils/sortMap.js"></script>
		<script src="../../../js/utils/http.js"></script>
		<script src="../../../js/app.js"></script>
		<!-- 基础js end -->

		<script type="text/javascript" charset="utf-8">
			var serviceNo;
			var sendTime;
			(function($, doc) {
				$.init();

				$.plusReady(function() {
					var self = plus.webview.currentWebview();
					serviceNo = self.serviceNo;
					sendTime = self.sendTime;
					h("#serviceNo").html(serviceNo);
					selectList();
				});
			}(mui, document));
			
			// 查询派单列表
			function selectList(){
				var fseId = app.getUser().enginnerId;
				ajaxPost(BASE_URL + "cc/ServiceLog/selectUnRelationServiceLogList", {
					"serviceNo": serviceNo,
					"fseId": fseId
				}, function(data) {
					// console.log(JSON.stringify(data))
					// 无数据
					if (data.data.length == 0) {
						h("#itemBox").html('<div class="nodata">—— 暂无数据 ——</div>');
						return false;
					}
					// 显示列表
					if (data.code === 200) {
						if(data.data!=""){
							var str = '';
							for(var i = 0; i<data.data.length; i++){
								var info = data.data[i];
								str += '<div class="item" onclick="jumpToNext(\'' + info.id + '\')">';
								str += '<div class="type">';
								str += '<p><div class="lpl">到达现场时间：</div><span>' + info.arriveTime +
									'</span><img src="../../../images/icon_202.png"/></p>';
								str += '</div>';
								str += '<div class="type">';
								str += '<p><div class="lpl">工作开始时间：</div><span>' + info.startTime +
									'</span><img src="../../../images/icon_202.png"/></p>';
								str += '</div>';
								str += '<div class="type">';
								str += '<p><div class="lpl">工作结束时间：</div><span>' + info.endTime +
									'</span><img src="../../../images/icon_202.png"/></p>';
								str += '</div>';
								str += '<div class="type" style="display: flex; width: 100%;">';
								var content = info.workContent == "undefiend" || info.workContent == null ? "" : info.workContent;
								str += '<img src="../../../images/icon_218.png"/><div class="lpl">工作内容：</div><span class="txt-overflow">' + content +
									'</span>';
								var isRelatedReport = !info.reportId || info.reportId == '' ? "未关联" : '已关联';
								str += '</div>';
								str += '<div class="type">';
								str += '<p><div class="lpl">是否关联服务报告：</div><span>' + isRelatedReport +
										'</span><img src="../../../images/icon_224.png"/></p>';
								str += '</div>';
								str += '</div>';
							}
							h('#itemBox').html(str);
						}else{
							html = '<div class="nodata">—— 暂无数据 ——</div>';
							h("#itemBox").html(html);
						}
					} else {
						var html = '<div class="nodata">—— 暂无数据 ——</div>';
						h("#itemBox").html(html);
						app.toast(data.msg)
					}
				}, function(errorMsg) {
					var html = '<div class="nodata">—— 暂无数据 ——</div>';
					h("#itemBox").html(html);
					app.toast("数据获取失败，请检查网络连接");
				});
			}
			
			// 跳转下一页
			function jumpToNext(id) {
				app.jumpTo("/view/service/serviceLog/logEdit.html","view/service/serviceLog/logEdit", {
					"logId" : id,
					"sendTime" : sendTime,
					"pageName": "logList"
				})
			}
			h("#dianji").tap(function(){
				app.jumpTo("/view/workArea/service/serveDetails.html", "view/workArea/service/serveDetails.html", {
					"serviceNo": serviceNo,
					"enginnerId": app.getUser().enginnerId
				})
			})

		</script>
		<!-- js代码 end -->
	</body>
</html>
